package com.pearadmin.hospital.service.impl;

import java.util.List;
import java.util.ArrayList;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pearadmin.common.web.domain.request.PageDomain;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pearadmin.hospital.mapper.HospitalSupplierMapper;
import com.pearadmin.hospital.domain.HospitalSupplier;
import com.pearadmin.hospital.service.IHospitalSupplierService;

/**
 * 供应商Service业务层处理
 * 
 * @author yuan
 * @date 2021-07-29
 */
@Service
public class HospitalSupplierServiceImpl implements IHospitalSupplierService 
{
    @Autowired
    private HospitalSupplierMapper hospitalSupplierMapper;

    /**
     * 查询供应商
     * 
     * @param id 供应商ID
     * @return 供应商
     */
    @Override
    public HospitalSupplier selectHospitalSupplierById(Integer id)
    {
        return hospitalSupplierMapper.selectHospitalSupplierById(id);
    }

    /**
     * 查询供应商列表
     * 
     * @param hospitalSupplier 供应商
     * @return 供应商
     */
    @Override
    public List<HospitalSupplier> selectHospitalSupplierList(HospitalSupplier hospitalSupplier)
    {
        return hospitalSupplierMapper.selectHospitalSupplierList(hospitalSupplier);
    }

    /**
     * 查询供应商
     * @param hospitalSupplier 供应商
     * @param pageDomain
     * @return 供应商 分页集合
     * */
    @Override
    public PageInfo<HospitalSupplier> selectHospitalSupplierPage(HospitalSupplier hospitalSupplier, PageDomain pageDomain)
    {
        PageHelper.startPage(pageDomain.getPage(),pageDomain.getLimit());
        List<HospitalSupplier> data = hospitalSupplierMapper.selectHospitalSupplierList(hospitalSupplier);
        return new PageInfo<>(data);
    }

    /**
     * 新增供应商
     * 
     * @param hospitalSupplier 供应商
     * @return 结果
     */

    @Override
    public int insertHospitalSupplier(HospitalSupplier hospitalSupplier)
    {
        return hospitalSupplierMapper.insertHospitalSupplier(hospitalSupplier);
    }

    /**
     * 修改供应商
     * 
     * @param hospitalSupplier 供应商
     * @return 结果
     */
    @Override
    public int updateHospitalSupplier(HospitalSupplier hospitalSupplier)
    {
        return hospitalSupplierMapper.updateHospitalSupplier(hospitalSupplier);
    }

    /**
     * 删除供应商对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteHospitalSupplierByIds(String[] ids)
    {
        return hospitalSupplierMapper.deleteHospitalSupplierByIds(ids);
    }

    /**
     * 删除供应商信息
     * 
     * @param id 供应商ID
     * @return 结果
     */
    @Override
    public int deleteHospitalSupplierById(Integer id)
    {
        return hospitalSupplierMapper.deleteHospitalSupplierById(id);
    }
}
